<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, the Front-Cover texts being (a) (see below), and
with the Back-Cover Texts being (b) (see below).  A copy of the
license is included in the section entitled "GNU
Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Prerequisites for GCC</title>

<meta name="description" content="Prerequisites for GCC">
<meta name="keywords" content="Prerequisites for GCC">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<h1 class="settitle" align="center">Prerequisites for GCC</h1>




















<span id="index-Prerequisites"></span>

<p>GCC requires that various tools and packages be available for use in the
build procedure.  Modifying GCC sources requires additional tools
described below.
</p>
<span id="Tools_002fpackages-necessary-for-building-GCC"></span><h3 class="heading">Tools/packages necessary for building GCC</h3>
<dl compact="compact">
<dt>ISO C++11 compiler</dt>
<dd><p>Necessary to bootstrap GCC.  GCC 4.8.3 or newer has sufficient
support for used C++11 features, with earlier GCC versions you
might run into implementation bugs.
</p>
<p>Versions of GCC prior to 11 also allow bootstrapping with an ISO C++98
compiler, versions of GCC prior to 4.8 also allow bootstrapping with a
ISO C89 compiler, and versions of GCC prior to 3.4 also allow
bootstrapping with a traditional (K&amp;R) C compiler.
</p>
<p>To build all languages in a cross-compiler or other configuration where
3-stage bootstrap is not performed, you need to start with an existing
GCC binary (version 4.8.3 or later) because source code for language
frontends other than C might use GCC extensions.
</p>
</dd>
<dt>C standard library and headers</dt>
<dd>
<p>In order to build GCC, the C standard library and headers must be present
for all target variants for which target libraries will be built (and not
only the variant of the host C++ compiler).
</p>
<p>This affects the popular &lsquo;<samp>x86_64-pc-linux-gnu</samp>&rsquo; platform (among
other multilib targets), for which 64-bit (&lsquo;<samp>x86_64</samp>&rsquo;) and 32-bit
(&lsquo;<samp>i386</samp>&rsquo;) libc headers are usually packaged separately. If you do a
build of a native compiler on &lsquo;<samp>x86_64-pc-linux-gnu</samp>&rsquo;, make sure you
either have the 32-bit libc developer package properly installed (the exact
name of the package depends on your distro) or you must build GCC as a
64-bit only compiler by configuring with the option
<samp>--disable-multilib</samp>.  Otherwise, you may encounter an error such as
&lsquo;<samp>fatal error: gnu/stubs-32.h: No such file</samp>&rsquo;
</p>
</dd>
<dt><span id="GNAT-prerequisite"></span>GNAT</dt>
<dd>
<p>In order to build GNAT, the Ada compiler, you need a working GNAT
compiler (GCC version 5.1 or later).
</p>
<p>This includes GNAT tools such as <code>gnatmake</code> and
<code>gnatlink</code>, since the Ada front end is written in Ada and
uses some GNAT-specific extensions.
</p>
<p>In order to build a cross compiler, it is strongly recommended to install
the new compiler as native first, and then use it to build the cross
compiler. Other native compiler versions may work but this is not guaranteed and
will typically fail with hard to understand compilation errors during the
build.
</p>
<p>Similarly, it is strongly recommended to use an older version of GNAT to build
GNAT. More recent versions of GNAT than the version built are not guaranteed
to work and will often fail during the build with compilation errors.
</p>
<p>Note that <code>configure</code> does not test whether the GNAT installation works
and has a sufficiently recent version; if too old a GNAT version is
installed and <samp>--enable-languages=ada</samp> is used, the build will fail.
</p>
<p><code>ADA_INCLUDE_PATH</code> and <code>ADA_OBJECT_PATH</code> environment variables
must not be set when building the Ada compiler, the Ada tools, or the
Ada runtime libraries. You can check that your build environment is clean
by verifying that &lsquo;<samp>gnatls -v</samp>&rsquo; lists only one explicit path in each
section.
</p>
</dd>
<dt><span id="GDC-prerequisite"></span>GDC</dt>
<dd>
<p>In order to build GDC, the D compiler, you need a working GDC
compiler (GCC version 9.4 or later) and D runtime library,
&lsquo;<samp>libphobos</samp>&rsquo;, as the D front end is written in D.
</p>
<p>Versions of GDC prior to 12 can be built with an ISO C++11 compiler, which can
then be installed and used to bootstrap newer versions of the D front end.
</p>
<p>It is strongly recommended to use an older version of GDC to build GDC. More
recent versions of GDC than the version built are not guaranteed to work and
will often fail during the build with compilation errors relating to
deprecations or removed features.
</p>
<p>Note that <code>configure</code> does not test whether the GDC installation works
and has a sufficiently recent version.  Though the implementation of the D
front end does not make use of any GDC-specific extensions, or novel features
of the D language, if too old a GDC version is installed and
<samp>--enable-languages=d</samp> is used, the build will fail.
</p>
<p>On some targets, &lsquo;<samp>libphobos</samp>&rsquo; isn&rsquo;t enabled by default, but compiles
and works if <samp>--enable-libphobos</samp> is used.  Specifics are
documented for affected targets.
</p>
</dd>
<dt><span id="GM2-prerequisite"></span>GM2</dt>
<dd>
<p>Python3 is required if you want to build the complete Modula-2
documentation including the target <code>SYSTEM</code> definition module.
If Python3 is unavailable Modula-2 documentation will include a target
independent version of the SYSTEM modules.
</p>
</dd>
<dt>A &ldquo;working&rdquo; POSIX compatible shell, or GNU bash</dt>
<dd>
<p>Necessary when running <code>configure</code> because some
<code>/bin/sh</code> shells have bugs and may crash when configuring the
target libraries.  In other cases, <code>/bin/sh</code> or <code>ksh</code>
have disastrous corner-case performance problems.  This
can cause target <code>configure</code> runs to literally take days to
complete in some cases.
</p>
<p>So on some platforms <code>/bin/ksh</code> is sufficient, on others it
isn&rsquo;t.  See the host/target specific instructions for your platform, or
use <code>bash</code> to be sure.  Then set <code>CONFIG_SHELL</code> in your
environment to your &ldquo;good&rdquo; shell prior to running
<code>configure</code>/<code>make</code>.
</p>
<p><code>zsh</code> is not a fully compliant POSIX shell and will not
work when configuring GCC.
</p>
</dd>
<dt>A POSIX or SVR4 awk</dt>
<dd>
<p>Necessary for creating some of the generated source files for GCC.
If in doubt, use a recent GNU awk version, as some of the older ones
are broken.  GNU awk version 3.1.5 is known to work.
</p>
</dd>
<dt>GNU binutils</dt>
<dd>
<p>Necessary in some circumstances, optional in others.  See the
host/target specific instructions for your platform for the exact
requirements.
</p>
<p>Note binutils 2.35 or newer is required for LTO to work correctly
with GNU libtool that includes doing a bootstrap with LTO enabled.
</p>
</dd>
<dt>gzip version 1.2.4 (or later) or</dt>
<dt>bzip2 version 1.0.2 (or later)</dt>
<dd>
<p>Necessary to uncompress GCC <code>tar</code> files when source code is
obtained via HTTPS mirror sites.
</p>
</dd>
<dt>GNU make version 3.80 (or later)</dt>
<dd>
<p>You must have GNU make installed to build GCC.
</p>
</dd>
<dt>GNU tar version 1.14 (or later)</dt>
<dd>
<p>Necessary (only on some platforms) to untar the source code.  Many
systems&rsquo; <code>tar</code> programs will also work, only try GNU
<code>tar</code> if you have problems.
</p>
</dd>
<dt>Perl version between 5.6.1 and 5.6.24</dt>
<dd>
<p>Necessary when targeting Darwin, building &lsquo;<samp>libstdc++</samp>&rsquo;,
and not using <samp>--disable-symvers</samp>.
Necessary when targeting Solaris with Solaris <code>ld</code> and not using
<samp>--disable-symvers</samp>.
</p>
<p>Necessary when regenerating <samp>Makefile</samp> dependencies in libiberty.
Necessary when regenerating <samp>libiberty/functions.texi</samp>.
Necessary when generating manpages from Texinfo manuals.
Used by various scripts to generate some files included in the source
repository (mainly Unicode-related and rarely changing) from source
tables.
</p>
<p>Used by <code>automake</code>.
</p>
<p>If available, enables parallel testing of &lsquo;<samp>libgomp</samp>&rsquo; in case that
<code>flock</code> is not available.
</p>
</dd>
</dl>

<p>Several support libraries are necessary to build GCC, some are required,
others optional.  While any sufficiently new version of required tools
usually work, library requirements are generally stricter.  Newer
versions may work in some cases, but it&rsquo;s safer to use the exact
versions documented.  We appreciate bug reports about problems with
newer versions, though.  If your OS vendor provides packages for the
support libraries then using those packages may be the simplest way to
install the libraries.
</p>
<dl compact="compact">
<dt>GNU Multiple Precision Library (GMP) version 4.3.2 (or later)</dt>
<dd>
<p>Necessary to build GCC.  It can be downloaded from
<a href="https://gmplib.org/">https://gmplib.org/</a>.  If a GMP source distribution is found in a
subdirectory of your GCC sources named <samp>gmp</samp>, it will be built
together with GCC.  Alternatively, if GMP is already installed but it
is not in your library search path, you will have to configure with the
<samp>--with-gmp</samp> configure option.  See also <samp>--with-gmp-lib</samp>
and <samp>--with-gmp-include</samp>.
The in-tree build is only supported with the GMP version that
download_prerequisites installs.
</p>
</dd>
<dt>MPFR Library version 3.1.0 (or later)</dt>
<dd>
<p>Necessary to build GCC.  It can be downloaded from
<a href="https://www.mpfr.org">https://www.mpfr.org</a>.  If an MPFR source distribution is found
in a subdirectory of your GCC sources named <samp>mpfr</samp>, it will be
built together with GCC.  Alternatively, if MPFR is already installed
but it is not in your default library search path, the
<samp>--with-mpfr</samp> configure option should be used.  See also
<samp>--with-mpfr-lib</samp> and <samp>--with-mpfr-include</samp>.
The in-tree build is only supported with the MPFR version that
download_prerequisites installs.
</p>
</dd>
<dt>MPC Library version 1.0.1 (or later)</dt>
<dd>
<p>Necessary to build GCC.  It can be downloaded from
<a href="https://www.multiprecision.org/mpc/">https://www.multiprecision.org/mpc/</a>.  If an MPC source distribution
is found in a subdirectory of your GCC sources named <samp>mpc</samp>, it
will be built together with GCC.  Alternatively, if MPC is already
installed but it is not in your default library search path, the
<samp>--with-mpc</samp> configure option should be used.  See also
<samp>--with-mpc-lib</samp> and <samp>--with-mpc-include</samp>.
The in-tree build is only supported with the MPC version that
download_prerequisites installs.
</p>
</dd>
<dt>isl Library version 0.15 or later.</dt>
<dd>
<p>Necessary to build GCC with the Graphite loop optimizations.
It can be downloaded from <a href="https://gcc.gnu.org/pub/gcc/infrastructure/">https://gcc.gnu.org/pub/gcc/infrastructure/</a>.
If an isl source distribution is found
in a subdirectory of your GCC sources named <samp>isl</samp>, it will be
built together with GCC.  Alternatively, the <samp>--with-isl</samp> configure
option should be used if isl is not installed in your default library
search path.
</p>
</dd>
<dt>zstd Library.</dt>
<dd>
<p>Necessary to build GCC with zstd compression used for LTO bytecode.
The library is searched in your default library patch search.
Alternatively, the <samp>--with-zstd</samp> configure option should be used.
</p>
</dd>
<dt>Python3 modules</dt>
<dd>
<p>The complete list of Python3 modules broken down by GCC subcomponent
is shown below:
</p>
<dl compact="compact">
<dt>internal debugging in gdbhooks</dt>
<dd><p><code>gdb</code>, <code>gdb.printing</code>, <code>gdb.types</code>,
<code>os.path</code>, <code>re</code>, <code>sys</code> and <code>tempfile</code>,
</p>
</dd>
<dt>g++ testsuite</dt>
<dd><p><code>gcov</code>, <code>gzip</code>, <code>json</code>, <code>os</code> and <code>pytest</code>.
</p>
</dd>
<dt>c++ cxx api generation</dt>
<dd><p><code>csv</code>, <code>os</code>, <code>sys</code> and <code>time</code>.
</p>
</dd>
<dt>modula-2 documentation</dt>
<dd><p><code>argparse</code>, <code>os</code>, <code>pathlib</code>, <code>shutil</code> and
<code>sys</code>.
</p>
</dd>
<dt>git developer tools</dt>
<dd><p><code>os</code> and <code>sys</code>.
</p>
</dd>
<dt>ada documentation</dt>
<dd><p><code>latex_elements</code>, <code>os</code>, <code>pygments</code>, <code>re</code>,
<code>sys</code> and <code>time</code>.
</p></dd>
</dl>

</dd>
</dl>

<span id="Tools_002fpackages-necessary-for-modifying-GCC"></span><h3 class="heading">Tools/packages necessary for modifying GCC</h3>
<dl compact="compact">
<dt>autoconf version 2.69</dt>
<dt>GNU m4 version 1.4.6 (or later)</dt>
<dd>
<p>Necessary when modifying <samp>configure.ac</samp>, <samp>aclocal.m4</samp>, etc.
to regenerate <samp>configure</samp> and <samp>config.in</samp> files.
</p>
</dd>
<dt>automake version 1.15.1</dt>
<dd>
<p>Necessary when modifying a <samp>Makefile.am</samp> file to regenerate its
associated <samp>Makefile.in</samp>.
</p>
<p>Much of GCC does not use automake, so directly edit the <samp>Makefile.in</samp>
file.  Specifically this applies to the <samp>gcc</samp>, <samp>intl</samp>,
<samp>libcpp</samp>, <samp>libiberty</samp>, <samp>libobjc</samp> directories as well
as any of their subdirectories.
</p>
<p>For directories that use automake, GCC requires the latest release in
the 1.15 series, which is currently 1.15.1.  When regenerating a directory
to a newer version, please update all the directories using an older 1.15
to the latest released version.
</p>
</dd>
<dt>gettext version 0.14.5 (or later)</dt>
<dd>
<p>Needed to regenerate <samp>gcc.pot</samp>.
</p>
</dd>
<dt>gperf version 2.7.2 (or later)</dt>
<dd>
<p>Necessary when modifying <code>gperf</code> input files, e.g.
<samp>gcc/cp/cfns.gperf</samp> to regenerate its associated header file, e.g.
<samp>gcc/cp/cfns.h</samp>.
</p>
</dd>
<dt>DejaGnu version 1.5.3 (or later)</dt>
<dt>Expect</dt>
<dt>Tcl</dt>
<dd>
<p>Necessary to run the GCC testsuite; see the section on testing for
details.
</p>
</dd>
<dt>autogen version 5.5.4 (or later) and</dt>
<dt>guile version 1.4.1 (or later)</dt>
<dd>
<p>Necessary to regenerate <samp>fixinc/fixincl.x</samp> from
<samp>fixinc/inclhack.def</samp> and <samp>fixinc/*.tpl</samp>.
</p>
<p>Necessary to run &lsquo;<samp>make check</samp>&rsquo; for <samp>fixinc</samp>.
</p>
<p>Necessary to regenerate the top level <samp>Makefile.in</samp> file from
<samp>Makefile.tpl</samp> and <samp>Makefile.def</samp>.
</p>
</dd>
<dt>Flex version 2.5.4 (or later)</dt>
<dd>
<p>Necessary when modifying <samp>*.l</samp> files.
</p>
<p>Necessary to build GCC during development because the generated output
files are not included in the version-controlled source repository.
They are included in releases.
</p>
</dd>
<dt>Texinfo version 4.7 (or later)</dt>
<dd>
<p>Necessary for running <code>makeinfo</code> when modifying <samp>*.texi</samp>
files to test your changes.
</p>
<p>Necessary for running <code>make dvi</code>, <code>make pdf</code>,
or <code>make html</code> to create formatted documentation.  Texinfo version
4.8 or later is required for <code>make pdf</code>.
</p>
<p>Necessary to build GCC documentation in info format during development
because the generated output files are not included in the repository.
(They are included in release tarballs.)
</p>
<p>Note that the minimum requirement is for a very old version of
Texinfo, but recent versions of Texinfo produce better-quality output,
especially for HTML format.  The version of Texinfo packaged with any
current operating system distribution is likely to be adequate for
building the documentation without error, but you may still want to
install a newer release to get the best appearance and usability of
the generated manuals.
</p>
</dd>
<dt>TeX (any working version)</dt>
<dd>
<p>Necessary for running <code>texi2dvi</code> and <code>texi2pdf</code>, which
are used when running <code>make dvi</code> or <code>make pdf</code> to create
DVI or PDF files, respectively.
</p>
</dd>
<dt>Sphinx version 1.0 (or later)</dt>
<dd>
<p>Necessary to regenerate <samp>jit/docs/_build/texinfo</samp> from the <samp>.rst</samp>
files in the directories below <samp>jit/docs</samp>.
</p>
</dd>
<dt>git (any version)</dt>
<dt>SSH (any version)</dt>
<dd>
<p>Necessary to access the source repository.  Public releases and weekly
snapshots of the development sources are also available via HTTPS.
</p>
</dd>
<dt>GNU diffutils version 2.7 (or later)</dt>
<dd>
<p>Useful when submitting patches for the GCC source code.
</p>
</dd>
<dt>patch version 2.5.4 (or later)</dt>
<dd>
<p>Necessary when applying patches, created with <code>diff</code>, to one&rsquo;s
own sources.
</p>
</dd>
</dl>

<hr />
<p>
<p><a href="./index.html">Return to the GCC Installation page</a>
</p>












</body>
</html>
